/*
 * BinaryAndOperatorAst.cpp
 *
 *  Created on: 1 Nov 2010
 *      Author: ph1109
 */

#include <MAlice/Ast/BinaryAndOperatorAst.h>

namespace MAlice {

BinaryAndOperatorAst::BinaryAndOperatorAst(ExpressionAst* lhs,
		ExpressionAst* rhs) : BinaryOperatorAst("&", lhs, rhs) {}

BinaryAndOperatorAst::~BinaryAndOperatorAst() {}

llvm::Value* BinaryAndOperatorAst::generate()
{
	llvm::Value* LHS = getLHS()->generate();
	llvm::Value* RHS = getRHS()->generate();

	checkType(LHS, RHS);

	Builder* builder = MAlice::Codegen::get()->getBuilder();

	return builder->CreateAnd(LHS, RHS);
}

}
